﻿using System;
using System.Xml;

namespace HuaCheng.Model
{
    public class Xmloperation
    {
        //xml文档
        public XmlDocument Doc { get; set; }
        //xml文档名
        public String Xmlfile { get; set; }
        public Xmloperation(String xmlfile)
        {
            this.Xmlfile = xmlfile;
            this.Doc = new XmlDocument();
        }
        /// <summary>
        /// 获取当前节点node下名字为elementname的节点
        /// </summary>
        /// <param name="elementname"></param>
        /// <returns></returns>
        public XmlElement GetTheElement(XmlElement node,String elementname)
        {
            XmlElement el = null;
            XmlNodeList topM = node.ChildNodes;
            foreach (XmlElement element in topM)
            {
                if (element.Name == elementname)
                {
                    el = element;
                }
            }
            return el;
        }
    }
}
